<template>
  <div class="assistant-container">
    <!-- 绿色头部区域 -->
    <header class="main-header">
      <div class="header-top">
        <span class="title">微信发票助手</span>
        <div class="header-actions">
          <img src="../assets/xcx.png" alt="小程序" class="icon-image header-icon" style="width: 30px !important; height: 30px !important; display: block !important;" />
          <div class="header-divider"></div>
          <img src="../assets/sxq.png" alt="刷新器" class="icon-image header-icon" style="width: 20px !important; height: 20px !important; display: block !important;" />
        </div>
      </div>
      <div class="header-buttons">
        <div class="action-button">
          <div class="icon-wrapper">
            <img src="../assets/add.png" alt="添加" class="icon-image" style="width: 30px !important; height: 30px !important; display: block !important;"/>
          </div>
          <p>添加发票</p>
        </div>
        <div class="action-button">
          <div class="icon-wrapper">
            <!-- 使用简单的 div 模拟文档图标 -->
            <img src="../assets/piaoju.png" alt="票据" class="icon-image" style="width: 30px !important; height: 30px !important; display: block !important;"/>
          </div>
          <p>我的发票</p>
        </div>
      </div>
    </header>

    <!-- 主要内容区域 -->
    <main class="content-area">
      <div class="card link-card" >
       <img src="../assets/youjian.png" class="icon-image" style="width: 24px !important; height: 24px !important; display: block !important; margin-right: 10px;"/>
        <span class="link-text">关联QQ邮箱，自动同步邮箱发票。</span>
        <button class="link-button">关联</button>
      </div>

      <div class="invoice-title-section">
        <p class="section-header">发票抬头</p>
        <div class="card add-title-card">
         <div class="icon-wrapper add-icon-wrapper">
            <img src="../assets/add2.png" alt="添加" class="icon-image" style="width: 30px !important; height: 30px !important; display: block !important;" />
          </div>
          <span class="add-text">添加发票抬头</span>
          <span class="arrow-icon">></span>
        </div>
      </div>
    </main>

    <!-- 页脚 -->
    <footer class="page-footer"  style="margin-bottom: 40px;">
      <a href="#" class="faq-link" style="font-size: 14px; font-weight: 500; letter-spacing: 1px;">常见问题</a>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'InvoiceAssistant'
}
</script>

<style scoped>
body, .assistant-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
}

.assistant-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f0f2f5; /* 微信页面常用的背景灰 */
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}



/* 绿色头部 */
.main-header {
  background-color: #07c160;
  color: white;
  padding-top: calc(5vh + 15px);
  padding-bottom: 20px;
  text-align: center;
  height: auto;
  min-height: 150px;
  max-height: 200px;
  width: 100%;
  box-sizing: border-box;
}

.header-top {
  display: flex;
  justify-content: center; /* 标题居中 */
  align-items: center;
  position: relative;
  margin-bottom: 4vh;
  padding: 0 15px;
}
.title {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 550;
  letter-spacing: 1px;
}
.header-actions {
  position: absolute;
  right: 5px;
  display: flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 50px;
  background-color: #229459;
  gap: 10px;
}

.header-divider {
  width: 1px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.2);
}
.header-actions .header-icon {
  width: clamp(18px, 5vw, 24px);
  height: clamp(18px, 5vw, 24px);
  margin-left: 5px;
}

.header-actions .gray-circle {
  position: absolute;
  top: -5px;
  right: -5px;
  width: clamp(8px, 2vw, 12px);
  height: clamp(8px, 2vw, 12px);
  background-color: #cccccc;
  border-radius: 50%;
  z-index: 1;
}

.header-buttons {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 5vh;
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
}
.action-button {
  cursor: pointer;
  width: 45%;
  max-width: 150px;
}
.action-button p {
  margin: 8px 0 0;
  font-size: clamp(12px, 3.5vw, 16px);
  white-space: nowrap;
}
.icon-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto;
}
.plus-icon {
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 300;
}
.icon-image {
  width: clamp(20px, 6vw, 28px);
  height: clamp(20px, 6vw, 28px);
  object-fit: contain;
  display: inline-block;
}
.doc-icon {
  width: 24px;
  height: 24px;
  border: 2px solid white;
  border-radius: 4px;
  padding: 2px;
}
.doc-icon .line {
  height: 2px;
  background: white;
  margin-top: 4px;
}
.action-button:last-child .icon-wrapper {
  border-radius: 10px;
}


/* 主要内容区域 */
.content-area {
  padding: 15px;
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
}
.card {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  width: 100%;
  box-sizing: border-box;
}

.link-card .mail-icon {
  font-size: clamp(16px, 5vw, 20px);
  margin-right: 10px;
}
.link-card .link-text {
  flex-grow: 1;
  font-size: clamp(11px, 3vw, 14px);
  padding-right: 5px;
}
.link-button {
  background-color: #07c160;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: clamp(12px, 3.5vw, 14px);
  cursor: pointer;
  white-space: nowrap;
}

.invoice-title-section .section-header {
  font-size: clamp(12px, 3.5vw, 16px);
  color: #888;
  padding: 0 5px 10px;
  margin: 20px 0 0;
}
.add-title-card {
  justify-content: flex-start;
  align-items: center;
  display: flex;
  padding: 12px 15px;
}
.add-icon {
  font-size: clamp(18px, 5vw, 22px);
  color: #888;
  margin-right: 10px;
}
.add-icon-wrapper {
  min-width: 24px;
  min-height: 24px;
  margin-right: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.add-icon-wrapper .icon-image {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  object-fit: contain !important;
}
.add-text {
  flex-grow: 1;
  font-size: clamp(14px, 4vw, 18px);
  color: #2c2c2c;
}
.arrow-icon {
  font-size: clamp(16px, 4.5vw, 20px);
  color: #ccc;
  font-weight: bold;
  margin-left: auto;
}

/* 页脚 */
.page-footer {
  padding: 20px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.faq-link {
  color: #576b95; /* 微信小程序常用链接色 */
  text-decoration: none;
  font-size: clamp(12px, 3.5vw, 16px);
}
.home-indicator {
  width: 30%;
  max-width: 134px;
  height: 5px;
  background-color: #000;
  border-radius: 100px;
  margin: 20px auto 10px;
}
/* 媒体查询，针对不同屏幕尺寸进行优化 */
@media screen and (max-width: 320px) {
  /* 小屏幕手机 */
  .main-header {
    padding-top: calc(3vh + 10px);
    min-height: 130px;
  }
  .header-buttons {
    margin-top: 3vh;
  }
  .action-button p {
    font-size: 12px;
  }
  .link-button {
    padding: 4px 8px;
  }
}

@media screen and (min-width: 321px) and (max-width: 375px) {
  /* 中等屏幕手机 */
  .main-header {
    padding-top: calc(4vh + 12px);
    min-height: 140px;
  }
}

@media screen and (min-width: 376px) and (max-width: 414px) {
  /* 较大屏幕手机 */
  .main-header {
    padding-top: calc(4vh + 15px);
  }
}

@media screen and (min-width: 415px) {
  /* 大屏幕手机或平板 */
  .main-header {
    padding-top: calc(5vh + 15px);
  }
  .card {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* 安全区域适配，适用于刘海屏、挖孔屏等特殊屏幕 */
@supports (padding-top: env(safe-area-inset-top)) {
  .main-header {
    padding-top: calc(env(safe-area-inset-top) + 15px);
  }
  .page-footer {
    padding-bottom: calc(env(safe-area-inset-bottom) + 15px);
  }
}
</style>